#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define INITIAL_CAPACITY 16 // 初始容量
#define LOAD_FACTOR 0.75    // 扩容负载因子
#define GROWTH_FACTOR 2     // 扩容倍数

typedef struct Node
{
    char *key;
    unsigned int value;
    struct Node *next;
} Node;

typedef struct
{
    Node **buckets;
    unsigned int size;
    unsigned int capacity;
} HashMap;
static unsigned long hash(const char *str);

// 创建节点并初始化
static Node *node_create(const char *key, unsigned int value);

// 初始化哈希表
HashMap *hashmap_create();

// 安全扩容实现
static void hashmap_resize(HashMap *map);

// 插入/更新键值对
int hashmap_put(HashMap *map, const char *key, unsigned int value);

// 查找键值对
unsigned int hashmap_get(HashMap *map, const char *key, unsigned int *found);

// 删除键值对
unsigned int hashmap_remove(HashMap *map, const char *key);

// 销毁哈希表
void hashmap_destroy(HashMap *map);

unsigned int is_float(const char *str);
unsigned int is_int(const char *str);
int loc_point(const char *str);
int is_sepcial(const char *str);
int loc_sepcial(const char *str);
void show_message(const char *show, unsigned int *result, HashMap *map, unsigned int found);